package com.kyu.LogDiff;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import java.io.IOException;

public class Driver {
    public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
        Configuration conf = new Configuration();
        Job job = Job.getInstance(conf);
        job.setJarByClass(Driver.class);           // 主类
        job.setMapperClass(Map.class);           // Mapper类
        job.setReducerClass(Reduce.class);       // Reducer类
//
//        job.setPartitionerClass();                  // 分区类
//        job.setNumReduceTasks(4);                     // Reduce使用的任务数, 生成的分片数

        job.setMapOutputKeyClass(Text.class);         // Map后出口参数Key的类型
        job.setMapOutputValueClass(Bean.class);       // Map后出口参数Value的类型

        job.setOutputKeyClass(Bean.class);            // MapReduce后出口参数Key的类型
        job.setOutputValueClass(NullWritable.class);          // MapReduce后出口参数Value的类型

        FileInputFormat.setInputPaths(job,new Path(args[0]));
        FileOutputFormat.setOutputPath(job,new Path(args[1]));
        job.waitForCompletion(true);
    }
}
